package com.ljh.seckill;

import com.ljh.seckill.utils.LockFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.DependsOn;
import org.springframework.data.redis.core.StringRedisTemplate;

/**
 * @Author grung
 * @Date 2021/2/24 11:24
 * @Version 1.0
 */

@SpringBootApplication
public class OrderApplication {

    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    /**
     * 锁工厂
     *
     * @param stringRedisTemplate
     * @return
     */
    @Bean
    @DependsOn("stringRedisTemplate")
    public LockFactory lockFactory(StringRedisTemplate stringRedisTemplate) {
        return new LockFactory(stringRedisTemplate);
    }
}
